package controller;

import mapper.AccountMapper;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.AccountService;
import vo.Account;

import java.util.List;

public class TestController {

    public static void main(String[] args) {

        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("springConfig.xml");

//        AccountMapper accountMapper = context.getBean(AccountMapper.class);

//        Account acc1 = context.getBean(Account.class);
//        acc1.setId(1);
//        acc1.setName("tom");
//        acc1.setMoney(1000);

//        Account acc2 = context.getBean(Account.class);
//        acc2.setId(2);
//        acc2.setName("jerry");
//        acc2.setMoney(2000);
//
//        Account acc3 = context.getBean(Account.class);
//        acc3.setId(3);
//        acc3.setName("kitty");
//        acc3.setMoney(3000);
//
//
////        accountMapper.addAccount(acc1);
//        accountMapper.addAccount(acc2);
//        accountMapper.addAccount(acc3);
//
//
//        List<Account> accounts = accountMapper.selectAllAccount();
//        System.out.println(accounts);

        AccountService accountService = context.getBean(AccountService.class);

        accountService.transferAccounts(1,5,500);


    }

}
